﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Training.Dia1.Data.Entities;

namespace Training.Dia1.Data.Mappings
{
    public class MeasureUnitMap : EntityTypeConfiguration<MeasureUnit>
    {
        public MeasureUnitMap()
        {
            //table
            ToTable("MeasureUnits");

            //pk
            HasKey(t => t.Id);

            //property
            Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(t => t.Name);
            Property(t => t.Abbreviation);

        }
    }
}
